<?php

/**
 * Created by PhpStorm.
 * User: evan
 * Date: 16/9/7
 * Time: 上午6:10
 */
class Social extends MY_Api_Controller
{
    /**
     * 关注
     */
    public function my_follow()
    {
        $uid   = $this->uid;
        $page  = (int)$this->input->get_post('page');
        $limit = (int)$this->input->get_post('limit');


        $this->load->service('user/service_user_social');
        $data = $this->service_user_social->my_follow($uid, $page, $limit);


        $this->json_output($data['data'], $data['status']);
    }


    /**
     * 我的关注列表
     */
    public function follow_list()
    {
        $uid   = $this->uid;
        $page  = (int)$this->input->get_post('page');
        $limit = (int)$this->input->get_post('limit');


        $this->load->service('user/service_user_social');
        $data = $this->service_user_social->follow_list($uid, $page, $limit);


        $this->json_output($data['data'], $data['status']);
    }


    /**
     * 我的粉丝列表
     */
    public function fans_list()
    {
        $uid   = $this->uid;
        $page  = (int)$this->input->get_post('page');
        $limit = (int)$this->input->get_post('limit');


        $this->load->service('user/service_user_social');
        $data = $this->service_user_social->fans_list($uid, $page, $limit);


        $this->json_output($data['data'], $data['status']);
    }


    /**
     * 关注(如已关注则取消关注)
     */
    public function follow()
    {
        $uid   = $this->uid;
        $follow_uid = (int)$this->input->get_post('follow_uid');


        $this->load->service('user/service_user_social');
        $data = $this->service_user_social->follow($uid, $follow_uid);


        $this->json_output($data['data'], $data['status']);
    }
    
    /**
     * 黑名单
     */
    public function blacklist()
    {
    	$uid   = $this->uid;
        $page  = (int)$this->input->get_post('page');
        $limit = (int)$this->input->get_post('limit');
    
    	$this->load->service('user/service_user_social');
    	$data = $this->service_user_social->blacklist($uid, $page, $limit);
    
    
    	$this->json_output($data['data'], $data['status']);
    }
    
    /**
     * 加入黑名单
     */
    public function blocked()
    {
    	$uid = $this->uid;
    	$other_uid = (int)$this->input->get_post('other_uid');
    
    	$this->load->service('user/service_user_social');
    	$data = $this->service_user_social->blocked($uid, $other_uid);
    
    	$this->json_output($data['data'], $data['status']);
    }
    
    /**
     * 删除黑名单
     */
    public function delete_blocked()
    {
    	$uid = $this->uid;
    	$other_uid = (int)$this->input->get_post('other_uid');
    
    	$this->load->service('user/service_user_social');
    	$data = $this->service_user_social->delete_blocked($uid, $other_uid);
    
    	$this->json_output($data['data'], $data['status']);
    }
}